
// SoundRecorderDlg.h : header file
//

#pragma once
#include "afxwin.h"
#include "afxvslistbox.h"
#include "afxcmn.h"
#include "AudioEngineInterface.h"
#include <string>
using std::string;
#include "AudioOscilloscope.h"

class AudioEngine;

// CSoundRecorderDlg dialog
class CSoundRecorderDlg : public CDialogEx,AudioEngineInterface
{
// Construction
public:
	CSoundRecorderDlg(CWnd* pParent = NULL);	// standard constructor
	~CSoundRecorderDlg();

// Dialog Data
	enum { IDD = IDD_SOUNDRECORDER_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);

	void OnTimer(UINT_PTR nIDEvent);

public://from class AudioEngineInterface
	void onAudioPlayFinished();
	void onAudioRecordedBuffer(const void* newBuffer,int newBufferSize,const WAVEFORMATEX& waveFormatex);

private:
	bool m_playing;
	bool m_recording;
	AudioEngine* m_audioEngine;

	CMFCButton m_playButton;
	CMFCButton m_recordButton;
	afx_msg void OnBnClickedMfcbuttonRecord();
	afx_msg void OnBnClickedMfcbuttonPlay();
	CVSListBox m_waveListBox;

	string m_moduleDataPath;

	CStatic m_labelWaveOscilloscope;

	BOOL m_recordAndPlay;

	AudioOscilloscope* m_audioOscilloscope;
public:
	afx_msg void OnBnClickedButtonClose();
};
